﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RaidHunter
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            RaidHunterSettings.myPrefs.Load();

            comboBoxReadiness.SelectedIndex = RaidHunterSettings.myPrefs.Readiness;
            comboBoxRapidFire.SelectedIndex = RaidHunterSettings.myPrefs.rapidfire;
            comboBoxBloodFury.SelectedIndex = RaidHunterSettings.myPrefs.bloodfury;
            comboBoxBerserking.SelectedIndex = RaidHunterSettings.myPrefs.berserking;
            comboBoxStampede.SelectedIndex = RaidHunterSettings.myPrefs.stampede;
            comboBoxLifeblood.SelectedIndex = RaidHunterSettings.myPrefs.lifeblood;
            comboBoxTrinket1.SelectedIndex = RaidHunterSettings.myPrefs.trinket1;
            comboBoxTrinket2.SelectedIndex = RaidHunterSettings.myPrefs.trinket2;
            comboBoxEngiGloves.SelectedIndex = RaidHunterSettings.myPrefs.engigloves;
            comboBoxmisdirection.SelectedIndex = RaidHunterSettings.myPrefs.misdirection;
            comboBoxAutoCallRevivePet.SelectedIndex = RaidHunterSettings.myPrefs.autocallrevivepet;
            comboBoxVirmenpotion.SelectedIndex = RaidHunterSettings.myPrefs.virmenpotion;
            comboBoxAgilityFlask.SelectedIndex = RaidHunterSettings.myPrefs.agilityflask;
            comboBoxAlchemyFlask.SelectedIndex = RaidHunterSettings.myPrefs.alchemyflask;
            comboBoxPauseKey.SelectedIndex = RaidHunterSettings.myPrefs.PauseKey;
            switch (RaidHunterSettings.myPrefs.PauseKey)
            {
                case 0:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.None;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LALT;
                    break;
                case 6:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RALT;
                    break;
            }
            comboBoxPauseCRKey.SelectedIndex = RaidHunterSettings.myPrefs.PauseCRKey;
            switch (RaidHunterSettings.myPrefs.PauseCRKey)
            {
                case 0:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.None;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LALT;
                    break;
                case 6:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RALT;
                    break;
            }
            comboBoxTier60.SelectedIndex = RaidHunterSettings.myPrefs.selectTier60;
            comboBoxTier75.SelectedIndex = RaidHunterSettings.myPrefs.selectTier75;
            comboBoxTier90.SelectedIndex = RaidHunterSettings.myPrefs.selectTier90;
            checkBox1.Checked = RaidHunterSettings.myPrefs.useSilencingShot;
            
            comboBoxUseTier60.SelectedIndex = RaidHunterSettings.myPrefs.useTier60;
            comboBoxUseTier75.SelectedIndex = RaidHunterSettings.myPrefs.useTier75;
            comboBoxUseTier90.SelectedIndex = RaidHunterSettings.myPrefs.useTier90;


            numericUpDownstartaoe.Value = new decimal(RaidHunterSettings.myPrefs.startaoe);
            numericUpDowncallpetnr.Value = new decimal(RaidHunterSettings.myPrefs.callpetnr);
            numericUpDownhealthstonepercent.Value = new decimal(RaidHunterSettings.myPrefs.healthstonepercent);
            numericUpDownMendPet.Value = new decimal(RaidHunterSettings.myPrefs.mendpetpercent);
            numericUpDown1.Value = new decimal(RaidHunterSettings.myPrefs.NormalMobs);
            numericUpDown2.Value = new decimal(RaidHunterSettings.myPrefs.BossMobs);

        }

        private void comboBoxRapidFire_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.rapidfire = comboBoxRapidFire.SelectedIndex;
        }

        private void comboBoxBloodFury_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.bloodfury = comboBoxBloodFury.SelectedIndex;
        }

        private void comboBoxBerserking_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.berserking = comboBoxBerserking.SelectedIndex;
        }

        private void comboBoxStampede_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.stampede = comboBoxStampede.SelectedIndex;
        }

        private void comboBoxLifeblood_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.lifeblood = comboBoxLifeblood.SelectedIndex;
        } 

        private void comboBoxTrinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.trinket1 = comboBoxTrinket1.SelectedIndex;
        }

        private void comboBoxTrinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.trinket2 = comboBoxTrinket2.SelectedIndex;
        }

        private void comboBoxEngiGloves_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.engigloves = comboBoxEngiGloves.SelectedIndex;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.Save();
            Close();
        }

        private void numericUpDownstartaoe_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.startaoe = (int)numericUpDownstartaoe.Value;
        }

        private void numericUpDowncallpetnr_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.callpetnr = (int)numericUpDowncallpetnr.Value;
        }

        private void comboBoxmisdirection_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.misdirection = comboBoxmisdirection.SelectedIndex;
        }

        private void comboBoxAutoCallRevivePet_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.autocallrevivepet = comboBoxAutoCallRevivePet.SelectedIndex;
        }

        private void comboBoxVirmenpotion_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.virmenpotion = comboBoxVirmenpotion.SelectedIndex;
        }

        private void comboBoxAgilityFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.agilityflask = comboBoxAgilityFlask.SelectedIndex;
        }

        private void comboBoxAlchemyFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.alchemyflask = comboBoxAlchemyFlask.SelectedIndex;
        }

        private void numericUpDownhealthstonepercent_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.healthstonepercent = (int)numericUpDownhealthstonepercent.Value;
        }

        private void numericUpDownMendPet_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.mendpetpercent = (int)numericUpDownMendPet.Value;
        }

        private void comboBoxPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.PauseKey = comboBoxPauseKey.SelectedIndex;
            switch (comboBoxPauseKey.SelectedIndex)
            {
                case 0:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.None;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.LALT;
                    break;
                case 6:
                    RaidHunterSettings.myPrefs.PauseKeys = RaidHunterSettings.Keypress.RALT;
                    break;
            }
        }

        private void comboBoxReadiness_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.Readiness = comboBoxReadiness.SelectedIndex;
        }

        private void comboBoxUseTier60_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.useTier60 = comboBoxUseTier60.SelectedIndex;
        }

        private void comboBoxUseTier75_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.useTier75 = comboBoxUseTier75.SelectedIndex;
        }

        private void comboBoxUseTier90_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.useTier90 = comboBoxUseTier90.SelectedIndex;
        }

        private void comboBoxTier60_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.selectTier60 = comboBoxTier60.SelectedIndex;
            switch (comboBoxUseTier60.SelectedIndex)
            {
                case 0:
                    RaidHunterSettings.myPrefs.Tier60 = 82726;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.Tier60 = 120679;
                    break;
            }
        }

        private void comboBoxTier75_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.selectTier75 = comboBoxTier75.SelectedIndex;
            switch (comboBoxUseTier75.SelectedIndex)
            {
                case 0:
                    RaidHunterSettings.myPrefs.Tier75 = 131894;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.Tier75 = 130392;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.Tier75 = 120697;
                    break;
            }
        }

        private void comboBoxTier90_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.selectTier90 = comboBoxTier90.SelectedIndex;
            switch (comboBoxUseTier90.SelectedIndex)
            {
                case 0:
                    RaidHunterSettings.myPrefs.Tier90 = 117050;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.Tier90 = 109259;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.Tier90 = 120360;
                    break;
            }
        }

        private void comboBoxPauseCRKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.PauseCRKey = comboBoxPauseCRKey.SelectedIndex;
            switch (comboBoxPauseCRKey.SelectedIndex)
            {
                case 0:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.None;
                    break;
                case 1:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.LALT;
                    break;
                case 6:
                    RaidHunterSettings.myPrefs.PauseCRKeys = RaidHunterSettings.Keypress.RALT;
                    break;
            }
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.NormalMobs = (int)numericUpDown1.Value;
        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.BossMobs = (int)numericUpDown2.Value;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            RaidHunterSettings.myPrefs.useSilencingShot = checkBox1.Checked;
        }

    }
}
